Skip to content

[3.0] Apply MaybeBool transformation to fields/properties#2574

Merged
Exanite merged 14 commits into
develop/3.0from
feature/bool-field-property-transformation
Jun 5, 2026
Merged

[3.0] Apply MaybeBool transformation to fields/properties#2574
Exanite merged 14 commits into
develop/3.0from
feature/bool-field-property-transformation

Conversation

@Exanite

@Exanite Exanite commented May 1, 2026

Copy link
Copy Markdown
Member

Summary of the PR

This adds MaybeBool transformation to fields and properties in TransformProperties, similar to how BoolTransformer for TransformFunctions currently works.

Related issues, Discord discussions, or proposals

Discord thread: https://discord.com/channels/521092042781229087/1499733234714546286

Further Comments

Tasks:

  • Implement BoolType to MaybeBool transformation
  • Update generator.json to use the new config option
  • Add test cases for TransformProperties
  • Wait for SDL update PR to be merged ([3.0] Update SDL and ClangSharp #2570)
  • Regenerate binding using Windows

@Exanite Exanite changed the base branch from main to develop/3.0 May 1, 2026 13:42
Not actually sure if this is ever going to be used, but I guess it will at least be consistent in behavior with BoolTransformer
@github-actions

github-actions Bot commented May 1, 2026

Copy link
Copy Markdown
Contributor

File Coverage
All files 16%

Minimum allowed coverage is 0%

Generated by 🐒 cobertura-action against 783e662

@Exanite Exanite left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Self review completed. Note that OpenAL/GL don't really have structs so no bindings changes there.

Comment thread sources/SilkTouch/SilkTouch/Mods/TransformFunctions.cs
Comment thread sources/SilkTouch/SilkTouch/Mods/TransformProperties.cs
@Exanite Exanite marked this pull request as ready for review May 18, 2026 16:30
@Exanite Exanite requested a review from a team as a code owner May 18, 2026 16:30
Comment thread sources/SilkTouch/SilkTouch/Mods/TransformProperties.cs
@Exanite Exanite marked this pull request as draft May 19, 2026 14:30

@Exanite Exanite left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Self review for new changes done. Still need to do some more verification before I open this PR for merging though. Edit: Done, just wanted to regenerate bindings again to verify nothing changed.

Comment thread sources/SilkTouch/SilkTouch/Mods/Common/ModUtils.cs
@Exanite Exanite marked this pull request as ready for review May 20, 2026 15:03
@Exanite Exanite merged commit 823485b into develop/3.0 Jun 5, 2026
22 checks passed
@Exanite Exanite deleted the feature/bool-field-property-transformation branch June 5, 2026 23:23
Exanite added a commit that referenced this pull request Jun 7, 2026
Exanite added a commit that referenced this pull request Jun 12, 2026
* Add WIP documentation for using the Silk 3 generator

* Add for-contributors/Generator folder

* Work on an outline for two new generator docs pages

* Work on high-level overview section

* Edit the overview section and begin writing about PrettifyNames

* Work on PrettifyNames section

* Omit the name processor parameters since they don't provide much additional info

* Edit wording

* Work on Name Splitting and Name Prettification sections

* Revise the name processing docs

* More editing

* Write the Acronym Indeterminate Inputs section

* Finish writing the Name Prettification section

* Work on name affixes section

* Add PrettifyNames - Notable Decisions section

* Write the Referenced Affixes section

* Add Name Affixes - Metadata Format section

* Add Referenced Affixes - Metadata Format section

* Remove completed todo

* Add test cases to cover ID3D12Device shared prefix identification behavior

* Write the Symbol-based Renamer section

* Edit name processing docs

* Reflow the text

* Add note on where the referenced affix example comes from

* Add example where only one of the two consecutive acronyms is preserved

* Begin working on generator mods docs

* Write the Mod Configuration section

* Add empty sections for each mod

* Clarify what information will go in the Available Mods section

* List out the name affix categories and work on outlining the rest of the docs

* Add information about usage recommendations section

* Work on docs and write the AddApiProfiles section

* Work on docs and attempt to write AddVTables usage recommendation

* Remove the WIP usage recommendations for AddVTables since I don't know enough to explain it

* Work on mods docs

* Add light docs for ClangScraper mod

* Add docs for ExtractHandles and add ExtractHandlesTests matching the example given in the docs

* Document that the example has a matching test case

* Change ModUtils.RelativePath() to work when no project path is available

This is because project path is null during unit tests and I can't figure out if it is possible to set the project path of an AdhocWorkspace project.

* Add TestUtils.VerifyDocumentsAsync

* Use Single instead of First since we expect one matching doc

* Work on ExtractNestedTyping docs and add SuccessfullyExtractsNestedInlineArray test case

* Work on docs and add SuccessfullyExtractsFunctionPointer test case

* Add SuccessfullyExtractsCStyleEnumConstants test case

* Add passing SuccessfullyExtractsCStyleEnumConstants_Pointer and failing SuccessfullyExtractsCStyleEnumConstants_ReturnType test case

* Add SuccessfullyExtractsCStyleEnumConstants_Field test case

* Rename snapshot to match renamed test

* Write the IdentifySharedPrefixes section

* Add note about IdentifySharedPrefixes's history

* Fix incorrect test document name

* Add more information to the IdentifySharedPrefixes section

* Fix and edit wording

* Add InterceptNativeFunctionsTests

* Write the InterceptNativeFunctions section

* Work on docs for MarkNativeNames

* Work on MixKhronosData docs

* Work on documenting the name affixes used by MixKhronosData

* Write docs for KhronosNonExclusiveVendor

* Finish writing the name affix docs for MixKhronosData

* Finish up the MixKhronosData section

* Write the PrettifyNames section

* Write the StripAttributes section

* Write the TransformEnums section and add note about ClangScraper platform differences

* Edit wording

* Attempt to write some docs for TransformFunctions

* Work on TransformHandles docs

* Write docs for TransformProperties and finish the first pass of the generator mod docs

Probably not going to too much of a second pass since I'm tired of writing docs and the idea is that these docs will improve over time. Going from no docs to almost everything documented is already a really good step forward.

* Adjust wording

* Add OpenAL and Vulkan to changelog

* Remove todos relating to PR #2574

* Document ClangScraper platform-specific differences and edit generator mod docs

* Add Library-Specific Notes doc

* Add link for more information

* Add link from ClangScraper section to Library-Specific Notes doc

* Fix incorrect title for Static vs Instance Bindings doc

* Add link from AddVTables section to Static vs Instance Bindings doc

* Prefer referring to native APIs using the term "API" rather than "library"

I saw that static-vs-instance-bindings.md used the terms "API" and "native API" to describe the APIs being bound to using SilkTouch.
I'm deciding to keep this pattern moving forward for consistency.

* Add links to Using the Generator and remap-stdint.rsp to generator-mods.md

* Work on Using the Generator docs

* Continue editing the Using the Generator docs

* Don't surround ClangSharpPInvokeGenerator in backticks

* Cleanup section on general eng/silktouch folder structure

* Finish editing the Using the Generator docs

* Cleanup

* Update test cases to use TestUtils.VerifyDocumentsAsync

* Cleanup

* Edit the intro to the Using the Generator docs

* Edit docs and avoid using inline code snippets in headers

* Add <see> reference to ClangScraper

(cherry picked from commit 3192da8be03dffedae9319636018ee901f959716)

* Change ExtractHandlesTests to not filter the verified documents list

* Add some spacing to the KhronosNonExclusiveVendor section

* Edit Generator Mods docs

* Edit MarkNativeNames to clarify who is responsible for adding NativeName attributes

* [3.0] Split up ExtractNestedTyping and add tests for TransformHandles (#2587)

* Start of generator fixes and polish branch

* Add stubs for ExtractEnumConstants and ExtractFunctionPointers

* Fix invalid interface implementation

* Work on splitting ExtractNestedTyping into 3 separate mods

* Continue to move code to their new locations

* Further cleanup

* Rename ExtractNestedTyping to ExtractNestedTypes

This is be more consistent with C#'s terminology now that ExtractNestedTypes strictly only handles NestedTypes and not other forms of "nested typing".

* Split ExtractNestedTypes tests into 3 sets of tests and ensure project is compilable (if not correct)

This is so I can start testing for expected behavior.

* Get ExtractNestedTypes working

* Update test snapshot names

* Get ExtractFunctionPointers working

* Fix subtly incorrect behavior and remove dependency on Mod for ExtractFunctionPointers/NestedTypes

* Move GetNativeTypeNameForPredefinedType to ExtractEnumConstants and cleanup

* Fix incorrect file name

* Prefer IMod over Mod where possible

This also means free performance since Mod sneakily creates a compilation and walks through it

* Document where ExtractFunctionPointers and ExtractNestedTypes output their extracted files

Also add todo for doing the same in ExtractEnumConstants

* Get ExtractEnumConstants working

* Update config

* Add remark comment on ExtractNestedTypes only handling ClangScraper's special structs

* Generate on Windows (apparently accidentally fixed a namespace bug)

* Remove unused code

* Cleanup GetNativeTypeNameForPredefinedType

* Use constructor and avoid nullable properties

We always allocate these so this is strictly a readability and performance improvement.

* Refactor code to use record structs

* Work on deciphering tuple usages

* Figure out what _numericTypeNames does

* Add support for requiredTargetSpecifier to TryParseNativeTypeName

* Handle method return types properly and fix SuccessfullyExtractsCStyleEnumConstants_ReturnType

* Cleanup todos

* Handle fields properly and fix SuccessfullyExtractsCStyleEnumConstants_Field

* Generate on Windows

* Cleanup

* Annotate extracted enums with [NativeName]

* Generate on Windows

* Add IEquatable to transformed handle types

These already implemented all the required members for IEquatable, so I found it weird that they didn't also implement the interface.

* Generate on Windows for IEquatable handles change

* Add TransformHandlesTests

* Reorder code for clarity

* Update docs with sections for the 3 mods ExtractNestedTyping was split into

* Change Sdl in ExtractEnumConstantsTests to be a class, not a struct

This is more representative of the actual bindings even though it doesn't affect the tests.

* Fix incorrect variable name and type name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants